<?php
/**
 * QQAS - share your knowledge to the world!
 *
 * @author		xiaochong0302 <xiaochong0302@gmail.com>
 * @copyright	Copyright (c) 2011, Koogua Studio.
 * @license		http://www.qqas.org/user_guide/license.html
 * @link		http://www.qqas.org
 * @since		Version 1.0
 * @filesource
 */


class AjaxAction extends AdminAction
{

	
	//初始化
	public function _initialize()
	{
		parent::_initialize();
	}


	//ip to country
	public function ipToCountry()
	{
	    $output = ip_to_country($_GET['ip']);
	    echo nl2br($output);
	}


	//获取禁止理由
	public function getBanReason()
	{
		$id = intval($_POST['id']);
		$Blacklist = M('Blacklist');
		$result = $Blacklist->find($id);
		exit(json_encode($result));	
	}
	
	
	//发送测试邮件
	public function sendTestEmail()
	{
		$to = $_POST['test_to'];
		$from = $_POST['test_from'];
		$subject = 'This is a test email';
		$message = 'This is a test email from <a href="http://www.qqas.org">QQAS</a>, share your knowledge to the world!';
		$Mailer = A('Mailer');
		$result = $Mailer->test($to, $subject, $message, $from);
		if ($result) 
		{
			exit(1);
		} else 	
		{
			exit(0);
		}
	}

}

/* End of file AjaxAction.class.php */
/* Location: .App/Lib/Action/Admin/AjaxAction.class.php */